/*
** ############################################################################
**     Project   : osdee - Operative Systems Design for Embedded Envrionments
**     File      : cdef.h
**     Revision  ; 1.0
**     Abstract  :
**         Types Definitions and common defines..
**     Processor : MC9S12XEP100CVL
**     Version   : Component 01.042, Driver 01.05, CPU db: 3.00.036
**     Datasheet : MC9S12XEP100 Rev. 1.19 12/2008
**
**     Copyright : 2014 Fernando Rodriguez, Open source with out any responsability.
**     
**     mail      : frr@gmail.com
** ############################################################################
*/

#ifndef _CDEF_H
#define _CDEF_H    

/*****************************************************************************************************
* Include files
*****************************************************************************************************/

/*****************************************************************************************************
* Declaration of project wide TYPES
*****************************************************************************************************/

typedef            unsigned  char        UINT8;   /*unsigned 8 bit definition */ 
typedef            unsigned  short       UINT16;  /*unsigned 16 bit definition*/ 
typedef            unsigned  long        UINT32;  /*unsigned 32 bit definition*/ 

typedef            signed    char        INT8;    /*signed 8 bit definition */ 
typedef                      short       INT16;   /*signed 16 bit definition*/ 
typedef                      long   int  INT32;   /*signed 32 bit definition*/                                          

typedef  volatile  unsigned  char        VUINT8;  /*unsigned 8 bit definition */ 
typedef  volatile  unsigned  short       VUINT16; /*unsigned 16 bit definition*/ 
typedef  volatile  unsigned  long        VUINT32; /*unsigned 32 bit definition*/

typedef  volatile  signed    char        VINT8;   /*signed 8 bit definition */ 
typedef  volatile            short       VINT16;  /*signed 16 bit definition*/ 
typedef  volatile            long   int  VINT32;  /*signed 32 bit definition*/ 

typedef            unsigned  char        CHAR;    /*unsigned 8 bit definition for S-Record support */

typedef            unsigned  char        BOOL;    /*Stores 1 as TRUE, 0 as FALSE*/

/*type used for callback function*/
typedef  void  ( * tCallbackFunction )( void  );
typedef  void  ( * tPtr_to_function  )( void  );


/*****************************************************************************************************
* Definition of module wide #DEFINE-CONSTANTs 
*****************************************************************************************************/

/* Common Constants */
#ifndef ON
	#define    ON     1u
#endif

#ifndef OFF
	#define    OFF    0u
#endif

#ifndef TRUE
	#define    TRUE    1u
#endif

#ifndef FALSE
	#define    FALSE    0u
#endif

#ifndef PASS
	#define    PASS    0u
#endif

#ifndef FAIL
	#define    FAIL    1u
#endif

#ifndef SET
	#define    SET    1u
#endif

#ifndef CLEAR
	#define    CLEAR    0u
#endif

#ifndef YES
	#define    YES    1u
#endif

#ifndef NO
	#define    NO     0u
#endif

#ifndef DISABLED
	#define 	 DISABLED  0u
#endif

#ifndef ENABLE
	#define 	 ENABLE 1u
#endif

#ifndef NULL
  #define    NULL    ( ( void * ) 0 )
#endif


/*****************************************************************************************************
* Definition of module wide #DEFINE-CONSTANTs 
*****************************************************************************************************/

#define    XIRQ_ENABLE()  { asm andcc #0xBF; }   /*XIRQ enabled              */ 
#define    WAIT()         { asm wait ;       }   /*enter wait mode           */ 
#define    STOP_ENABLE()  { asm andcc #0x7F; }   /*stop mode enabled         */ 
#define    STOP()         { asm stop ;       }   /*enter stop mode           */ 
#define    NOP()          { asm nop ;        }   /*enter NOP asm instruction */ 


#endif /* CDEF_H */ 